package office;

public class SpaceDate {
		MyDate dateStart;
		MyDate dateFinish;

		SpaceDate(){
			/* NOT */
		}

		SpaceDate(MyDate dateStart){
			this.dateStart = dateStart;
		}

		SpaceDate(MyDate dateStart, MyDate dateFinish){
			this.dateStart = dateStart;
			this.dateFinish = dateFinish;
		}

		void setDateStart(MyDate dateStart){
			this.dateStart = dateStart;
		}

		void setDateFinish(MyDate dateFinish){
			this.dateFinish = dateFinish;
		}

		MyDate getDateStart(){
			return dateStart;
		}

		MyDate getDateFinish(){
			return dateFinish;
		}

		boolean chekTotalSpaceDate(SpaceDate that){
			
			if( this.dateStart.compareTo(that.dateFinish) <= 0 && this.dateFinish.compareTo(that.dateStart) >= 0)
				return true;			
			
			return false;
		}
		
		
		SpaceDate crossingSpaceDate(SpaceDate that) {
			SpaceDate tmpSpaceDate = new SpaceDate();
			
			if(this.dateStart.compareTo(that.dateStart) > 0){
				tmpSpaceDate.setDateStart(this.dateStart);
			} else{
				tmpSpaceDate.setDateStart(that.dateStart);
			}
			
			if(this.dateFinish.compareTo(that.dateFinish) >0){
				tmpSpaceDate.setDateFinish(that.dateFinish);
			} else{
				tmpSpaceDate.setDateFinish(this.dateFinish);
			}
			
			
			return tmpSpaceDate;	
		}
		
		
		
		@Override
		public String toString() {
			return "SpaceDate [dateStart=" + dateStart + ", dateFinish="
					+ dateFinish + "]";
		}	

		
	}